package game.scene.map.event;
import dgo.tilemap.*;

public class EventParameters {
  public String chipID;
  public byte dir, wait, speedType, layer, frameNo, hitX, hitY, offsetX, offsetY;
  public int alpha;
  public boolean routeRepeat, routeSkip, passCharacters, passTile, passEvent, moveAnime, stayAnime, visible, dirFix;
  
  public EventParameters(
    String chipID, 
    byte hitX, 
    byte hitY, 
    byte offsetX, 
    byte offsetY, 
    byte dir, 
    byte frameNo, 
    int alpha, 
    byte wait, 
    byte speedType, 
    boolean routeRepeat, 
    boolean routeSkip, 
    byte layer, 
    boolean dirFix, 
    boolean moveAnime, 
    boolean stayAnime, 
    boolean passTile, 
    boolean passCharacters, 
    boolean passEvent, 
    boolean visible
  ){
    this.chipID = chipID;
    this.hitX = hitX;
    this.hitY = hitY;
    this.offsetX = offsetX;
    this.offsetY = offsetY;
    this.dir = dir;
    this.frameNo = frameNo;
    this.alpha = alpha;
    this.wait = wait;
    this.speedType = speedType;
    this.routeRepeat= routeRepeat;
    this.routeSkip = routeSkip;
    this.layer = layer;
    this.dirFix = dirFix;
    this.moveAnime = moveAnime;
    this.stayAnime = stayAnime;
    this.passCharacters = passCharacters;
    this.passTile = passTile;
    this.passEvent = passEvent;
    this.visible = visible;
  }
  
  public EventParameters(){
    this.chipID = null;
    this.hitX = 1;
    this.hitY = 1;
    this.offsetX = 0;
    this.offsetY = 0;
    this.dir = 3;
    this.frameNo = 1;
    this.alpha = 255;
    this.wait = 0;
    this.speedType = 1;
    this.routeRepeat= false;
    this.routeSkip = false;
    this.layer = 1;
    this.moveAnime = true;
    this.stayAnime = false;
    this.passCharacters = false;
    this.passTile = false;
    this.passEvent = false;
    this.visible = false;
  }
  
  public static EventParameters cloneCharacterEventParameters(MapCharacter p){
    return new EventParameters(
          p.chipset.name,
          p.hitX,
          p.hitY,
          p.offsetX,
          p.offsetY,
          (byte)(p.sy * p.chipset.dirNumber + p.getCurrentDir()),
          (byte)(p.sx * p.chipset.animationFrameNumber + p.frameNo), 
          p.alpha, 
          p.wait, 
          p.getSpeedType(), 
          false, 
          false, 
          p.layer,
          p.dirFix, 
          p.moveAnime, 
          p.stayAnime, 
          p.passTile, 
          p.passCharacters, 
          p.passEvent,
          p.visible
        );
  }
  
  public EventParameters clone(){
    return new EventParameters(
          chipID,
          hitX,
          hitY,
          offsetX,
          offsetY,
          dir,
          frameNo, 
          alpha, 
          wait, 
          speedType, 
          routeRepeat, 
          routeSkip, 
          layer,
          dirFix, 
          moveAnime, 
          stayAnime, 
          passTile, 
          passCharacters, 
          passEvent,
          visible
        );
  }
}
